let {news} = require('./news.json');

let result = news.map((item, key) => {
    item.id = key+1;
    return item;
})

require('fs').writeFileSync(__dirname + '/news-2.json', JSON.stringify({news: result}));